(function(e){"use strict";var t="addImage_";var r=function(e){"use strict";var t,r;if(!e.charCodeAt(0)===255||!e.charCodeAt(1)===216||!e.charCodeAt(2)===255||!e.charCodeAt(3)===224||!e.charCodeAt(6)==="J".charCodeAt(0)||!e.charCodeAt(7)==="F".charCodeAt(0)||!e.charCodeAt(8)==="I".charCodeAt(0)||!e.charCodeAt(9)==="F".charCodeAt(0)||!e.charCodeAt(10)===0){throw new Error("getJpegSize requires a binary jpeg file")}var a=e.charCodeAt(4)*256+e.charCodeAt(5);var i=4,n=e.length;while(i<n){i+=a;if(e.charCodeAt(i)!==255){throw new Error("getJpegSize could not find the size of the image")}if(e.charCodeAt(i+1)===192||e.charCodeAt(i+1)===193||e.charCodeAt(i+1)===194||e.charCodeAt(i+1)===195||e.charCodeAt(i+1)===196||e.charCodeAt(i+1)===197||e.charCodeAt(i+1)===198||e.charCodeAt(i+1)===199){r=e.charCodeAt(i+5)*256+e.charCodeAt(i+6);t=e.charCodeAt(i+7)*256+e.charCodeAt(i+8);return[t,r]}else{i+=2;a=e.charCodeAt(i)*256+e.charCodeAt(i+1)}}},a=function(e){var t=this.internal.newObject(),r=this.internal.write,a=this.internal.putStream;e["n"]=t;r("<</Type /XObject");r("/Subtype /Image");r("/Width "+e["w"]);r("/Height "+e["h"]);if(e["cs"]==="Indexed"){r("/ColorSpace [/Indexed /DeviceRGB "+(e["pal"].length/3-1)+" "+(t+1)+" 0 R]")}else{r("/ColorSpace /"+e["cs"]);if(e["cs"]==="DeviceCMYK"){r("/Decode [1 0 1 0 1 0 1 0]")}}r("/BitsPerComponent "+e["bpc"]);if("f"in e){r("/Filter /"+e["f"])}if("dp"in e){r("/DecodeParms <<"+e["dp"]+">>")}if("trns"in e&&e["trns"].constructor==Array){var i="";for(var n=0;n<e["trns"].length;n++){i+=e[i][n]+" "+e["trns"][n]+" ";r("/Mask ["+i+"]")}}if("smask"in e){r("/SMask "+(t+1)+" 0 R")}r("/Length "+e["data"].length+">>");a(e["data"]);r("endobj")},i=function(){var e=this.internal.collections[t+"images"];for(var r in e){a.call(this,e[r])}},n=function(){var e=this.internal.collections[t+"images"],r=this.internal.write,a;for(var i in e){a=e[i];r("/I"+a["i"],a["n"],"0","R")}};e.addImage=function(e,a,o,c,s,h){"use strict";if(typeof e==="object"&&e.nodeType===1){var d=document.createElement("canvas");d.width=e.clientWidth;d.height=e.clientHeight;var l=d.getContext("2d");if(!l){throw"addImage requires canvas to be supported by browser."}l.drawImage(e,0,0,d.width,d.height);e=d.toDataURL("image/jpeg");a="JPEG"}if(a.toUpperCase()!=="JPEG"){throw new Error("addImage currently only supports format 'JPEG', not '"+a+"'")}var f,C=this.internal.collections[t+"images"],g=this.internal.getCoordinateString,A=this.internal.getVerticalCoordinateString;if(e.substring(0,23)==="data:image/jpeg;base64,"){e=atob(e.replace("data:image/jpeg;base64,",""))}if(C){f=Object.keys?Object.keys(C).length:function(e){var t=0;for(var r in e){if(e.hasOwnProperty(r)){t++}}return t}(C)}else{f=0;this.internal.collections[t+"images"]=C={};this.internal.events.subscribe("putResources",i);this.internal.events.subscribe("putXobjectDict",n)}var p=r(e);var u={w:p[0],h:p[1],cs:"DeviceRGB",bpc:8,f:"DCTDecode",i:f,data:e};C[f]=u;if(!s&&!h){s=-96;h=-96}if(s<0){s=-1*u["w"]*72/s/this.internal.scaleFactor}if(h<0){h=-1*u["h"]*72/h/this.internal.scaleFactor}if(s===0){s=h*u["w"]/u["h"]}if(h===0){h=s*u["h"]/u["w"]}this.internal.write("q",g(s),"0 0",g(h),g(o),A(c+h),"cm /I"+u["i"],"Do Q");return this}})(jsPDF.API);
//# sourceMappingURL=jspdf.plugin.addimage.map.js